﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HA.Data
{
    [Serializable]
    public class DOVector : ICloneable
    {


        //控制说明：如果使用不定长模式，则根据每个单元格的向量的摸乘以比例进行显示；如果使用定长模式即_isVaryLength = false，则根据长度直接进行显示，不乘以比例


        [field: NonSerialized]
        public event EventHandler VectorsSetupChanged;


        #region 目前设计使用的字段属性

        bool _isAutoCompLength = true;
        /// <summary>
        /// 标记是否使用自动计算长度
        /// </summary>
        public bool IsAutoCompLength
        {
            get { return _isAutoCompLength; }
            set { _isAutoCompLength = value; }
        }
        double _length = 100;
        /// <summary>
        /// 总长度（包括箭头和尾部）
        /// </summary>
        public double Length
        {
            get { return _length; }
            set { _length = value; }
        }
      
        bool _isVaryLength = false;
        /// <summary>
        /// 是否使用VaryLength  ，  即使用不定长箭头模式表示
        /// </summary>
        public bool IsVaryLength
        {
            get { return _isVaryLength; }
            set { _isVaryLength = value; }
        }
        bool _isAutoCompScaling = true;
        /// <summary>
        /// 是否使用自动计算缩放比例
        /// </summary>
        public bool IsAutoCompScaling
        {
            get { return _isAutoCompScaling; }
            set { _isAutoCompScaling = value; }
        }
        double _scaling=1.0;
        /// <summary>
        /// 缩放比例
        /// </summary>
        public double Scaling
        {
            get { return _scaling; }
            set { _scaling = value; }
        }


        #endregion



        #region 暂时不使用的字段属性


        double _bHeadWith = 15;
        /// <summary>
        /// 箭头头部的宽度半径（Length的百分比）
        /// </summary>
        public double BHeadWith
        {
            get { return _bHeadWith; }
            set { _bHeadWith = value; }
        }

        double _cHeadWith = 20;
        /// <summary>
        /// 箭头头部的长度（Length的百分比）
        /// </summary>
        public double CHeadWith
        {
            get { return _cHeadWith; }
            set { _cHeadWith = value; }
        }
        double _stemWith = 2;
        /// <summary>
        /// 箭头尾部的宽度半径（Length的百分比）
        /// </summary>
        public double StemWith
        {
            get { return _stemWith; }
            set { _stemWith = value; }
        }

        bool _isVaryColor = false;

        public bool IsVaryColor
        {
            get { return _isVaryColor; }
            set { _isVaryColor = value; }
        }
        bool _isDisplay = false;

        public bool IsDisplay
        {
            get { return _isDisplay; }
            set { _isDisplay = value; }
        }
        double _displayEvery = 3;

        public double DisplayEvery
        {
            get { return _displayEvery; }
            set { _displayEvery = value; }
        }
        bool _isUseEachMinAndMax = false;

        public bool IsUseEachMinAndMax
        {
            get { return _isUseEachMinAndMax; }
            set { _isUseEachMinAndMax = value; }
        }
        bool _isColorSpecified = false;

        public bool IsColorSpecified
        {
            get { return _isColorSpecified; }
            set { _isColorSpecified = value; }
        }
        double _minMagnitude;

        public double MinMagnitude
        {
            get { return _minMagnitude; }
            set { _minMagnitude = value; }
        }
        double _maxMagnitude = 1;

        public double MaxMagnitude
        {
            get { return _maxMagnitude; }
            set { _maxMagnitude = value; }
        }


        #endregion


        public object Clone()
        {
            return this.MemberwiseClone();
        }



        public void ResetVecorOption(DOVector vector)
        {
            this._bHeadWith = vector._bHeadWith;
            this._cHeadWith = vector._cHeadWith;
            this._displayEvery = vector._displayEvery;
            this._isAutoCompLength = vector._isAutoCompLength;
            this._isAutoCompScaling = vector._isAutoCompScaling;
            this._isColorSpecified = vector._isColorSpecified;
            this._isDisplay = vector._isDisplay;
            this._isUseEachMinAndMax = vector._isUseEachMinAndMax;
            this._isVaryColor = vector._isVaryColor;
            this._isVaryLength = vector._isVaryLength;
            this._length = vector._length;
            this._maxMagnitude = vector._maxMagnitude;
            this._minMagnitude = vector._minMagnitude;
            this._scaling = vector._scaling;
            this._stemWith = vector._stemWith;
           

            if (VectorsSetupChanged != null)
            {
                this .VectorsSetupChanged (this ,new EventArgs() );
            }

            //触发事件


        }
    }
}
